package com.atguigu.spring5.dao;

import org.aspectj.weaver.patterns.ArgsAnnotationPointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @date: 2021/12/9 14:55
 * @description:
 */
@Repository
public class UserDaoImpl implements UserDao{
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void reduceMoney(Object[] args) {
        String sql = "update t_account set money=money-? where username=?";
        jdbcTemplate.update(sql, args);
    }

    @Override
    public void addMoney(Object[] args) {
        String sql = "update t_account set money=money+? where username=?";
        jdbcTemplate.update(sql, args);
    }
}
